﻿using System;
using System.Collections.Generic;
using IInject.Registration;

namespace IInject.Resolution
{
	/// <summary>
	/// 
	/// </summary>
	public interface IDependencyResolver
	{
		/// <summary>
		/// 
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
		bool CanResolve(Type type);
	}

	/// <summary>
	/// 
	/// </summary>
	/// <typeparam name="TDependency"></typeparam>
	public interface IDependencyResolver<out TDependency> : IDependencyResolver where TDependency : IDependency
	{
		/// <summary>
		/// 
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <returns></returns>
		TDependency Resolve<T>();
		/// <summary>
		/// 
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="key"></param>
		/// <returns></returns>
		TDependency Resolve<T>(string key);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
		TDependency Resolve(Type type);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="type"></param>
		/// <param name="key"></param>
		/// <returns></returns>
		TDependency Resolve(Type type, string key);
		/// <summary>
		/// 
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <returns></returns>
		IEnumerable<TDependency> ResolveAll<T>();
		/// <summary>
		/// 
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <returns></returns>
        IEnumerable<TDependency> ResolveAll<T>(string key);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
        IEnumerable<TDependency> ResolveAll(Type type, string key);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="context"></param>
		/// <returns></returns>
		TDependency Build(RegistryContext context);
	}
}
